package cn.web.tunnelrobot.controller;

import cn.web.tunnelrobot.dto.Project1;
import cn.web.tunnelrobot.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * 项目
 * @version 1.0.0
 *
 */
@RestController
@RequestMapping("/project")
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    @PostMapping("/addProject")
    public HashMap<String,Object> addProject(Project1 project){
        return projectService.addProject(project);
    }

    @PostMapping("/updateProject")
    @ResponseBody
    public HashMap<String,Object> updateProject( Project1 project){
        return projectService.updateProject(project);
    }
    @GetMapping("/getProjectList")
    @ResponseBody
    public HashMap<String,Object> getProjectList(@RequestParam(required = false) Integer uiId){
        return projectService.getProjectList(uiId);
    }

    @GetMapping("/getProjectById")
    @ResponseBody
    public HashMap<String,Object> getProjectById(@RequestParam Integer prId){
        return projectService.getProjectById(prId);
    }

    @GetMapping("/getProjectByIdNew")
    @ResponseBody
    public HashMap<String,Object> getProjectByIdNew(@RequestParam Integer prId){
        return projectService.getProjectByIdNew(prId);
    }

    @GetMapping("/getProjectId")
    @ResponseBody
    public HashMap<String,Object> getProjectId(){
        HashMap<String,Object> map = new HashMap<String,Object>();
        map.put("code",0);
        map.put("prId",1);
        return map;
    }

    @GetMapping("/deleteProjectById")
    @ResponseBody
    public HashMap<String,Object> deleteProjectById(@RequestParam Integer prId){
        return projectService.deleteProjectByPrId(prId);
    }
}
